package com.yhk.wuchat.common.user.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @version 1.0
 * @Author moresuo
 * @Date 2024/4/17 21:42
 * @注释
 */
@Getter
@AllArgsConstructor
public enum BlackTypeEnum {
    UID(1,"UID"),
    IP(2,"IP");

    private final Integer type;
    private final String desc;

    private static Map<Integer,BlackTypeEnum> cache;
    static{
        cache= Arrays.stream(BlackTypeEnum.values()).collect(Collectors.toMap(BlackTypeEnum::getType, Function.identity()));
    }
    private static BlackTypeEnum of(Integer id){
        return cache.get(id);
    }
}
